<%@page import="java.util.Date,java.util.Calendar,java.util.GregorianCalendar"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix ="spring" uri = "http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<head>
	<link rel="stylesheet" type="text/css" href="<c:url value="/static/css/search.css"/>"></link>
	<jsp:include page="load-google-maps.jsp"></jsp:include>
	<script type="text/javascript" src="http://www.google.com/jsapi"></script>
	<script type="text/javascript" src="<c:url value="/static/js/components/widget.js"/>"></script>
	<script type="text/javascript" src="<c:url value="/static/js/search-dy.js"/>"></script>
</head>
<c:url value="/search" var="action"/>
<form:form id="form" method="post" action="${action}" commandName="eventFilter">
<input type="hidden" value="${eventFilter.dateFrom}" name="dateFrom" id="dateFrom"/>
<input type="hidden" value="${eventFilter.dateTo}" name="dateTo" id="dateTo"/>
<input type="hidden" value="${eventFilter.locality}" name="locality" id="locality"/>
<input type="hidden" value="${eventFilter.latMin}" name="latMin" id="latMin"/>
<input type="hidden" value="${eventFilter.latMax}" name="latMax" id="latMax"/>
<input type="hidden" value="${eventFilter.lngMin}" name="lngMin" id="lngMin"/>
<input type="hidden" value="${eventFilter.lngMax}" name="lngMax" id="lngMax"/>
<input type="hidden" value="${eventFilter.category}" name="category" id="category"/>
<div>
	<div class="filter_container">
		<div class="title"><spring:message code="label.location"/></div>
		<div>
			<input id="location" type="text" value="${eventFilter.locality}" title="<spring:message code='label.from'/>"/>
		</div>
		<div  class="search_option"><spring:message code="label.near"/></div>
	</div>

	<div class="filter_container">
		<div class="title"><spring:message code="label.date"/></div>
		<div>
			<input id="from" type="date" readonly="readonly" class="date calendar-widget" title="<spring:message code='label.from'/>"/>
			<input id="to" type="date" readonly="readonly" class="date calendar-widget" title="<spring:message code='label.to'/>"/>
			<span class="tiny-button-class" id="date_filters"><spring:message code="label.go"/></span>
		</div>
		<a  class="search_option search_filter" href="!#filters[dateFrom]=<%= (new GregorianCalendar().getTimeInMillis()/ 86400000) * 86400000  %>&filters[dateTo]=<%= (new GregorianCalendar().getTimeInMillis()/ 86400000) * 86400000%>"><spring:message code="label.today"/></a>
		<a  class="search_option search_filter" href="!#filters[dateFrom]=<%= (new GregorianCalendar().getTimeInMillis()/ 86400000) * 86400000 + 86400000%>&filters[dateTo]=<%= (new GregorianCalendar().getTimeInMillis()/ 86400000) * 86400000 + 86400000%>"><spring:message code="label.tomorrow"/></a>
		<a  class="search_option search_filter" href="!#filters[dateFrom]=<%= (new GregorianCalendar().getTimeInMillis()/ 86400000) * 86400000%>&filters[dateTo]=<%= (new GregorianCalendar().getTimeInMillis()/ 86400000) * 86400000 + (7- new GregorianCalendar().get(Calendar.DAY_OF_WEEK))* 86400000%>"><spring:message code="label.this.week"/></a>
		<a  class="search_option search_filter" href="!#filters[dateFrom]=<%= (new GregorianCalendar().getTimeInMillis()/ 86400000) * 86400000%>&filters[dateTo]=<%= (new GregorianCalendar().getTimeInMillis()/ 86400000) * 86400000 + (new GregorianCalendar().getActualMaximum(Calendar.DAY_OF_MONTH)- new GregorianCalendar().get(Calendar.DAY_OF_MONTH))* 86400000%>"><spring:message code="label.this.month"/></a>
	</div>
	<div class="filter_container">
		<div class="title"><spring:message code="label.categories"/></div>
		<c:forEach items="${categoriesOptions}" var="category">
			<a class="search_option category_option search_filter" id="${category.id}" href="!#filters[category]=${category.id}">${category.description}</a>
		</c:forEach>
	</div>
	<div class="filter_container">
		<div class="title"><spring:message code="input.label.price"/></div>
		<div>
			<div id="precio">
				<input id="priceMin" name="priceMin" value="${eventFilter.priceMin}" type="text" patron="\d{0,6}" title="<spring:message code='label.from'/>"/>
				<input id="priceMax" name="priceMax" value="${eventFilter.priceMax }" type="text" patron="\d{0,6}" title="<spring:message code='label.to'/>"/>
				<span class="tiny-button-class" id="price_filters"><spring:message code="label.go"/></span>
			</div>
			<div class="search_option search_filter" name="free:true|priceMin:|priceMax:"><spring:message code="label.free"/></div>
		</div>
	</div>
</div>
</form:form>